<%@page import="cn.school.entity.Subject"%>
<%@page import="java.util.List"%>
<%@page import="cn.school.service.Service3"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td>课程编号</td>
<td>课程名称</td>
<td>小时</td>
<td>年级编号</td>
</tr>
<%
Service3 st=new Service3();
int pageNo=1;
try{
pageNo=Integer.parseInt(request.getParameter("pageNo"));
}catch(Exception e){}
List<Subject> list=st.getAllInfo(pageNo, 10);
int total=st.total();
int pageTotal=total/10+(total%10==0?0:1);//总页数
for(Subject s:list){
%>
<tr>
<td><%=s.getId() %></td><td><%=s.getSubjectName() %></td>
<td><%=s.getClassHour() %></td><td><%=s.getGradeId() %></td>
</tr>
<%} %>
</table>
<p aligh="center">
<%
if(pageNo>1){
%>
<a href="subjectLimit.jsp?pageNo=<%=pageNo-1%>">上一页</a>
<%} %>
<%
if(pageTotal>pageNo){
%>
<a href="subjectLimit.jsp?pageNo=<%=pageNo+1%>">下一页</a>
<%} %>
<a href="subjectLimit.jsp?pageNo=<%=pageTotal%>">尾页</a>
</p>
</body>
</html>